<!-- toaster directive -->
<toaster-container toaster-options="{'position-class': 'toast-top-right', 'close-button':true}"></toaster-container>
<!-- / toaster directive -->

<!-- 导航条 -->
<div class="bg-white bread-crumb">
    <ul class="breadcrumb b-a m-b-n-xs lter b-b wrapper-md">
        <li><a ui-sref="main.tpl.homePage"><i class="fa fa-home"></i> 首页</a></li>
        <li class="active" ng-bind="title"></li>
    </ul>
</div>

<!-- 加载提醒 -->
<div ng-show="loading" class="text-center m-t-md text-lg"><i class="fa fa-spin fa-spinner"></i> 数据加载中...</div>

<!-- 内容区域 -->
<div ng-hide="loading" class="wrapper-md content">
    <!-- 数据显示 -->
    <div class="wrapper-data">
        <div class="panel panel-default">
            <!-- 头部 -->
            <div class="panel-body">
                <form ng-submit="searchRe()" class="form-horizontal">
                    <div class="form-group center">
                        <div class="col-md-2">
                            <input type="text" class="form-control" placeholder="请输入用户ID" ng-model="param.supplyId">
                        </div>
                        <div class="col-md-2">
                            <input type="text" class="form-control" placeholder="请输入流量主名称" ng-model="param.supplyName">
                        </div>
                      <!--  <div class="col-md-2">
                            <input name="minPrice" id="search_minPrice"  ng-model="param.minPrice" class="form-control" placeholder="请输入价格(小)" type="text"/>
                        </div>
                        <div class="col-md-2">
                            <input name="maxPrice" id="search_maxPrice" ng-model="param.maxPrice" class="form-control" placeholder="请输入价格（大）" type="text"/>
                        </div>-->
                        <div class="col-sm-2">
                            <input type="text" ng-model="param.createMinTime" placeholder="开始申请时间"  id="createMinTime" class="form-control" onclick="laydate({istime: true, format: 'YYYY-MM-DD', start: laydate.now(0, 'YYYY-MM-DD')})"/>
                        </div>
                        <div class="col-sm-2">
                            <input type="text" ng-model="param.createMaxTime" placeholder="结束申请时间"  id="createMaxTime" class="form-control" onclick="laydate({istime: true, format: 'YYYY-MM-DD', start: laydate.now(0, 'YYYY-MM-DD')})"/>
                        </div>
                        <div class="col-md-2">
                            <select class="form-control" ng-model="param.adType">
                                <option value="">--全部类型--</option>
                                <option value="1">单片</option>
                                <option value="2">轮播</option>
                            </select>
                        </div>
                        <div class="col-md-2">
                            <select class="form-control" ng-model="param.adForm">
                                <option value="">--全部形式--</option>
                                <option value="1">纯图片</option>
                                <option value="2">图文</option>
                                <option value="3">纯文字</option>
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-sm-2">
                            <input type="text" class="form-control" placeholder="请输入行业关键字" ng-model="param.industryKeyWord">
                        </div>
                        <div class="col-sm-2">
                            <input type="text" ng-model="param.approveMinTime" id="approveMinTime" placeholder="开始审核时间" class="form-control" onclick="laydate({istime: true, format: 'YYYY-MM-DD', start: laydate.now(0, 'YYYY-MM-DD')})"/>
                        </div>
                        <div class="col-sm-2">
                            <input type="text" ng-model="param.approveMaxTime" id="approveMaxTime" placeholder="结束审核时间" class="form-control" onclick="laydate({istime: true, format: 'YYYY-MM-DD', start: laydate.now(0, 'YYYY-MM-DD')})"/>
                        </div>
                        <div class="col-sm-2">
                            <select class="form-control" ng-model="param.state">
                                <option value="">--全部状态--</option>
                                <option value="2">待审核</option>
                                <option value="3">启用中/审核成功</option>
                                <option value="4">审核失败</option>
                                <option value="5">停用中</option>
                                <option value="6">取消/删除</option>
                            </select>
                        </div>
                        <div class="col-md-2">
                            <input type="text" class="form-control" placeholder="广告位名称" ng-model="param.adSlotName">
                        </div>


                    </div>
                    <div class="form-group">
                        <div class="col-md-1">
                            <label class="col-sm-1 control-label"><button class="ifc-btn btn-primary" type="submit">查 询</button></label>
                        </div>
                        <div class="col-md-1">
                            <label class="col-sm-1 control-label"><button type="button" class="ifc-btn btn-success" ng-click="batchApprove(3)" >批量通过</button></label>
                        </div>
                        <div class="col-md-1">
                            <label class="col-sm-1 control-label"><button type="button" class="ifc-btn btn-danger"  ng-click="preview()" >批量失败</button></label>
                        </div>
                    </div>
                    <div class="cover" ng-show="firstApply">
                        <div class="firstApplyWrap">
                            <div class="clear"><i class="iconfont closeBtn noselect" ng-click="firstApply=false">&#xe608;</i></div>
                            <div class="title" ><textarea  placeholder="请输入审核失败的原因......" class="form-control" rows="5" id="remark"></textarea>
                                <div class="modal-footer">
                                    <button type="button" class="btn btn-default" ng-click="firstApply=false" data-dismiss="modal">取消</button>
                                    <button type="button" class="btn btn-primary" ng-click="batchApprove(4)">确定</button>
                                </div>
                            </div>

                        </div>
                    </div>
                </form>
            </div>

            <!-- 数据表格 -->
            <div class="table-responsive">
                <table class="table table-striped b-t b-light text-center">
                    <thead>
                    <tr>
                        <th><input type="checkbox" ng-click="selectAll($event)"/>全选</th>
                     <!--   <th>广告位名称</th>-->
                        <th>广告位ID</th>
                        <th>广告位名称</th>
                        <th>用户ID</th>
                        <th>流量主名称</th>
                        <th>平台名称<!--/渠道类型--></th>
                        <th>广告模式</th>
                      <!--  <th>行业关键字</th>-->
                        <th>广告形式</th>
                        <th>服务价格</th>
                        <th>申请时间</th>
                        <th>审核时间</th>
                        <th>状态</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr ng-repeat="item in pageInfo.records">
                        <td><input type="checkbox" name="selected" ng-checked="isSelected(item.id)" ng-click="updateSelection($event,item)"/></td>
                      <!--  <td class="v-middle">{{item.adSlotName}}</td>-->
                        <td class="v-middle">{{item.id}}</td>
                        <td class="v-middle">{{item.adSlotName}}</td>
                        <td class="v-middle">{{item.supplyId}}</td>
                        <td class="v-middle">{{item.supplyName}}</td>
                        <td class="v-middle" title="{{item.platformName}}">{{item.platformName|limitTo:10}}<!--/{{item.platformType=='1'?'网站':'APP'}}--></td>
                        <td class="v-middle">
                            <span ng-if="item.adType==1">单片</span>
                            <span ng-if="item.adType==2">轮播</span>
                        </td>
                        <!--<td class="v-middle" title="{{item.industryKeyword}}">{{item.industryKeyword|limitTo:4}}</td>-->
                        <td class="v-middle">
                            <span ng-if="item.adForm==1">纯图片</span>
                            <span ng-if="item.adForm==2">图文</span>
                            <span ng-if="item.adForm==3">纯文字</span>
                        </td>
                        <td class="v-middle"><span id="clickPrice{{item.id}}">{{item.price}}</span>
                            <div id="btn{{item.id}}" style="display: none"><input type="text" id="price{{item.id}}" style="width: 50px"  value="{{item.price}}"><button type="button"  ng-click="updatePrice('P',item.id,item.clickPrice)">保存</button></div></td>

                        <td class="v-middle">{{item.createTime | date:'yyyy-MM-dd HH:mm:ss'}}</td>

                        <td class="v-middle">
                            <span ng-if="item.state==3||item.state==4">{{item.approveTime | date:'yyyy-MM-dd HH:mm:ss'}}</span>
                            <span ng-if="item.state!=3 && item.state!=4">-</span>
                        </td>

                        <td class="v-middle">
                            <span ng-if="item.state==1">未提交</span>
                            <span ng-if="item.state==2" class="text-danger">待审核</span>
                            <span ng-if="item.state==3" class="text-success">启用中</span>
                            <span ng-if="item.state==4">审核失败</span>
                            <span ng-if="item.state==5">停用中</span>
                            <span ng-if="item.state==6">取消/删除</span>
                        </td>

                        <td class="v-middle">
                            <a ui-sref="main.biz.adSlot.detail({id: item.id})" class="btn btn-sm btn-default">
                                <i class="fa fa-edit m-r-xs text-sm"></i>详情</a>

                          <!--  <button type="button" ng-if="item.state==2" ng-click="approve(item.id,3)" class="btn btn-sm btn-default m-l-xs">
                                <i class="fa fa-check m-r-xs text-sm"></i>通过</button>

                            <button type="button" ng-if="item.state==2" ng-click="approve(item.id,4)" class="btn btn-sm btn-default m-l-xs">
                                <i class="fa fa-ban m-r-xs text-sm"></i>失败</button>-->

                            <button type="button" ng-if="item.state!=3" ng-click="changePrice(item.id,0)" class="btn btn-sm btn-default m-l-xs">
                                <i class="fa fa-edit m-r-xs text-sm"></i>改价</button>
                        </td>
                    </tr>
                    </tbody>
                </table>
            </div><!-- /.table-responsive -->

            <!-- 底部分页 -->
            <span data-ng-include=" 'src/tpl/pageInfo.html' "></span>
        </div><!-- /.panel -->
    </div><!-- /.wrapper-data -->

</div><!-- /.wrapper-md -->
<style>
    .cover {
        position: fixed;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.5);
        z-index: 2000;
        top: 0;
        left: 0;
        /* display: none; */
    }

    .firstApplyWrap{
        width: 550px;
        height:280px;
        background: #fff;
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%,-50%);
        -webkit-transform: translate(-50%,-50%);
        -ms-transform: translate(-50%,-50%);
        -o-transform: translate(-50%,-50%);
        -moz-transform: translate(-50%,-50%);
        border-radius: 5px;
        overflow: hidden;
    }
    .firstApplyWrap .title{
        font-size: 18px;
        color:#333;
        padding:18px 36px 0 36px;
        text-align: center;
        line-height: 2em;
    }
    .firstApplyWrap .closeBtn,.finishData .closeBtn{
        font-size: 30px;
        padding:5px 10px 0 0;
        border-radius: 50%;
        color: #ccc;
        float: right;
        cursor: pointer;
    }
    .finishData .closeBtn{
        position: absolute;
        top:10px;
        right:10px;
    }
    .firstApplyWrap .bkgIcon{
        position: absolute;
        left: 54px;
        top:87px;
        font-size: 50px;
        color:#FFB136;
    }
    .firstApplyWrap .applyBtnWrap{
        position: absolute;
        bottom: -2px;
        width: 100%;
    }
    .firstApplyWrap .applyBtn{
        width: 50%;
        height:70px;
        line-height: 70px;
        background: #FFB135;
        font-size: 20px;
        text-align: center;
        color:#fff;
        cursor: pointer;
        float:left;
    }
    .firstApplyWrap .applyBtn:last-child{
        background: #5796FC;
    }
</style>
